package org.cshoo.sys.business
{
	import hessian.client.HessianService;
	
	import mx.collections.ArrayCollection;
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	
	import org.cshoo.common.business.ServiceLocator;
	import org.cshoo.sys.model.vo.Role;
	import org.cshoo.sys.model.vo.User;
	
	public class AuthorityDelegate
	{
		public var serviceLocator:ServiceLocator = ServiceLocator.getInstance();
		
		public var _service:HessianService;
		
		private var _responder:IResponder;
		
		public function AuthorityDelegate(responder:IResponder)
		{
			_service = serviceLocator.authorityService;
			this._responder = responder;
		}
		
		public function findRoleAuthorityList(role:Role):void
		{
			var asyncToken:AsyncToken　=　_service.getOperation("findRoleAuthorityList").send(role);
			asyncToken.addResponder(_responder);
		}
		
		public function findUserAuthorityList(user:User):void
		{
			var asyncToken:AsyncToken　=　_service.getOperation("findUserAuthorityList").send(user);
			asyncToken.addResponder(_responder);
		}
		
		public function addRoleAuthorityList(role:Role,menuList:ArrayCollection):void
		{
			var asyncToken:AsyncToken　=　_service.getOperation("addRoleAuthorityList").send(role,menuList);
			asyncToken.addResponder(_responder);
		}
		
		public function addUserAuthorityList(user:User,menuList:ArrayCollection):void
		{
			var asyncToken:AsyncToken　=　_service.getOperation("addUserAuthorityList").send(user,menuList);
			asyncToken.addResponder(_responder);
		}
	}
}